<template>
  <div class="api-test-container">
    <div class="left-panel">
      <div class="search-box">
        <el-input v-model="searchText" placeholder="搜索API" prefix-icon="el-icon-search" clearable />
      </div>
      <div class="api-list">
        <div v-for="(api, index) in filteredApis" :key="index" class="api-item"
          :class="{ active: currentApiIndex === index }" @click="selectApi(index)">
          <div class="api-name">{{ api.name }}</div>
          <div class="api-method" :class="api.method">{{ api.method }}</div>
          <div class="api-location">{{ api.location }}</div>
        </div>
      </div>
    </div>

    <div class="right-panel">
      <div v-if="currentApi" class="api-detail">
        <div class="api-header">
          <h2>{{ currentApi.name }}</h2>
          <div class="api-meta">
            <el-tag :type="methodTagType" class="method-tag">
              {{ currentApi.method.toUpperCase() }}
            </el-tag>
            <span class="api-url">{{ currentApi.location }}</span>
            <el-button type="primary" size="small" @click="sendRequest(currentApi.need)" :loading="sending">
              发送请求
            </el-button>
          </div>
        </div>

        <div class="request-section">
          <h3>请求参数</h3>

          <div v-if="currentApi.need == 0">
            <div class="params-editor">
              <div class="param-row" v-for="(param, key, index) in requestParams" :key="key">
                <el-input v-model="param.key" placeholder="参数名" class="param-key" />
                <el-input v-model="param.value" placeholder="参数值" class="param-value" />
                <el-button type="danger" icon="el-icon-delete" circle size="mini" @click="removeParam(index)" />
              </div>
              <el-button type="text" icon="el-icon-plus" @click="addParam">
                添加参数
              </el-button>
            </div>

            <div class="file-upload" v-if="currentApi.method === 'post'">
              <h4>文件上传</h4>
              <el-upload class="upload-demo" action="#" :on-change="handleFileChange" :auto-upload="false"
                :file-list="fileList" :limit="3" multiple>
                <el-button size="small" type="primary">选择文件</el-button>
                <div slot="tip" class="el-upload__tip">
                  支持上传jpg/png/pdf/doc等文件，且不超过500kb
                </div>
              </el-upload>
            </div>
          </div>
          <div v-if="currentApi.need == 2" class="upload-container">
            <div>
            </div>
            <el-upload class="face-upload" list-type="picture-card" action="#" :auto-upload="false"
              :show-file-list="false" name="files" :on-change="handleSearchFaceChange"
              accept="image/*,.jpg,.jpeg,.png,.gif,.bmp,.webp">
              <img v-if="formData1.face" class="img" :src="formData1.face.url" alt="" srcset="">
              <i v-else class="el-icon-plus img"></i>
              <div slot="tip" class="el-upload__tip">上传人脸图片</div>
            </el-upload>
          </div>

          <div v-if="currentApi.need == 3" class="upload-group">
            <div class="upload-item">
              <h4 class="upload-title">上传第一张人脸图片</h4>

              <el-upload class="compare-upload" list-type="picture-card" action="#" :limit="1" :auto-upload="false"
                :show-file-list="false" name="files" :on-change="handleChange">

                <img v-if="imageUrl1" class="img" :src="imageUrl1" alt="" srcset="">
                <i v-else class="el-icon-plus img"></i>
                <div slot="tip" class="el-upload__tip">支持jpg/png格式</div>
              </el-upload>

            </div>

            <div class="upload-item">
              <h4 class="upload-title">上传第二张人脸图片</h4>

              <el-upload class="compare-upload" list-type="picture-card" action="#" :limit="1" :auto-upload="false"
                name="files" :show-file-list="false" :on-change="handleChangeFaceImg2">
                <img v-if="imageUrl2" class="img" :src="imageUrl2" alt="" srcset="">
                <i v-else class="el-icon-plus img"></i>
                <div slot="tip" class="el-upload__tip">支持jpg/png格式</div>
              </el-upload>

            </div>
          </div>

          <div v-if="currentApi.need == 4" class="upload-container">
            <div>
              <div class="params-editor">
                <div class="param-row" v-for="(param, key, index) in requestParams" :key="key">
                  <el-input v-model="param.key" placeholder="参数名" class="param-key" />
                  <el-input v-model="param.value" placeholder="参数值" class="param-value" />
                  <el-button type="danger" icon="el-icon-delete" circle size="mini" @click="removeParam(index)" />
                </div>
                <el-button type="text" icon="el-icon-plus" @click="addParam">
                  添加参数
                </el-button>
              </div>

            </div>
            <el-upload class="face-upload" list-type="picture-card" action="#" :auto-upload="false"
              :show-file-list="false" name="files" :on-change="handleSearchFaceChangeSearch"
              accept="image/*,.jpg,.jpeg,.png,.gif,.bmp,.webp">
              <img v-if="formDataSearch.face" class="img" :src="formDataSearch.face.url" alt="" srcset="">
              <i v-else class="el-icon-plus img"></i>
              <div slot="tip" class="el-upload__tip">上传人脸图片</div>
            </el-upload>
          </div>
          <div v-if="currentApi.need == 1" class="upload-container">
            <div>
              <div class="params-editor">
                <div class="param-row" v-for="(param, key, index) in requestParams" :key="key">
                  <el-input v-model="param.key" placeholder="参数名" class="param-key" />
                  <el-input v-model="param.value" placeholder="参数值" class="param-value" />
                  <el-button type="danger" icon="el-icon-delete" circle size="mini" @click="removeParam(index)" />
                </div>
                <el-button type="text" icon="el-icon-plus" @click="addParam">
                  添加参数
                </el-button>
              </div>

            </div>
            <el-upload class="face-upload" list-type="picture-card" action="#" :auto-upload="false"
              :show-file-list="false" name="files" :on-change="handleSearchFaceChangeset"
              accept="image/*,.jpg,.jpeg,.png,.gif,.bmp,.webp">
              <img v-if="forms.face" class="img" :src="forms.face.url" alt="" srcset="">
              <i v-else class="el-icon-plus img"></i>

              <div slot="tip" class="el-upload__tip">上传人脸图片</div>
            </el-upload>
          </div>
        </div>

        <div class="response-section">
          <h3>响应结果</h3>
          <div class="response-tabs">
            <el-tabs v-model="activeResponseTab">
              <el-tab-pane label="原始数据" name="raw">
                <pre class="response-data">{{ responseData }}</pre>
              </el-tab-pane>
              <el-tab-pane label="格式化" name="formatted" v-if="isJsonResponse">
                <json-viewer :value="jsonResponse" :expand-depth="3" copyable boxed sort />
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>

      <div v-else class="empty-state">
        <el-empty description="请从左侧选择API进行测试"></el-empty>
      </div>
    </div>
  </div>
</template>

<script>
import JsonViewer from 'vue-json-viewer'
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { detectFace, searchFace, compare } from '@/api/system/database'
import { addFaceSetFace } from '@/api/system/FaceSetFace'
export default {
  name: 'ApiTest',
  components: {
    JsonViewer,
  },
  data() {
    return {
      isShowFace1: false,
      isShowFace2: false,
      isShowFace3: false,
      imageUrl1: '',
      imageUrl2: '',
      formData: {
        files: [],
      },
      formData1: {
        face: '',
      },
      formDataSearch: {
        face: '',
      },
      forms: {
        face: '',
      },
      test: '',
      baseURL: 'http://1.95.199.171:18080',
      searchText: '',
      currentApiIndex: null,
      requestParams: [],
      fileList: [],
      responseData: '',
      activeResponseTab: 'raw',
      sending: false,
      list: [
        //   {
        //   name: '',
        //   location: '',
        //   method: 'get',
        //   body: {
        //   }
        // },
        {
          name: '1.通过登录获取token',
          location: '/login',
          method: 'post',
          body: {
            username: 'admin',
            password: '123456',
          },
          need: 0,
        },
        {
          name: '2.人脸集新增',
          location: '/system/FaceSetFace',
          method: 'post',
          body: {
            faceSetId: '1dvlbuuD',
          },
          need: 1,
        },
        {
          name: '3.人脸集删除',
          location: '/system/FaceSetFace/',
          method: 'delete',
          body: {
            id: '2',
          },
          need: 0,
        },
        {
          name: '4.人脸集查询',
          location: '/system/FaceSetFace/list',
          method: 'get',
          body: {
            pageNum: 1,
            pageSize: 10,
          },
          need: 0,
        },
        {
          name: '5.人脸添加API',
          location: '/system/FaceSetInfo',
          method: 'post',
          body: {
            faceSetId: '1dvlbuuD',
          },
          need: 1,
        },
        {
          name: '6.人脸查询API',
          location: '/system/FaceSetFace/showFacesByFaceId',
          method: 'get',
          body: {
            faceId: 'xQDVB0dJ',
            faceSetName: 'guahaobu',
          },
          need: 0,
        },
        {
          name: '7.人脸删除API',
          location: '/system/FaceSetFace/removeFace',
          method: 'get',
          body: {
            faceId: 'xQDVB0dJ',
            faceSetName: 'guahaobu',
          },
          need: 0,
        },
        {
          name: '8.人脸更新API',
          location: '/system/FaceSetFace/updateFaceByFaceId',
          method: 'post',
          body: {
            faceId: 'gdzSfOmn',
            externalImageId: '123',
            faceSetName: 'zhuyuanbu',
          },
          need: 0,
        },
        {
          name: '9.人脸检测',
          location: '/system/compareFace/detectFace',
          method: 'post',
          body: {},
          need: 2,
        },

        {
          name: '10.人脸对比',
          location: '/system/compareFace/compare',
          method: 'post',
          body: {},
          need: 3,
        },
        {
          name: '11.人脸搜索',
          location: '/system/compareFace/searchFace',
          method: 'post',
          body: {
            faceSetName: 'guahaobu',
          },
          need: 4,
        },
       
      ],
    }
  },
  computed: {
    filteredApis() {
      if (!this.searchText) return this.list
      return this.list.filter(
        (api) =>
          api.name.toLowerCase().includes(this.searchText.toLowerCase()) ||
          api.location.toLowerCase().includes(this.searchText.toLowerCase())
      )
    },
    currentApi() {
      return this.currentApiIndex !== null
        ? this.list[this.currentApiIndex]
        : null
    },
    methodTagType() {
      const method = this.currentApi?.method.toLowerCase()
      switch (method) {
        case 'get':
          return 'success'
        case 'post':
          return 'warning'
        case 'put':
          return 'primary'
        case 'delete':
          return 'danger'
        default:
          return 'info'
      }
    },
    isJsonResponse() {
      try {
        JSON.parse(this.responseData)
        return true
      } catch {
        return false
      }
    },
    jsonResponse() {
      try {
        return JSON.parse(this.responseData)
      } catch {
        return {}
      }
    },
  },
  methods: {
    handleSearchFaceChangeset(file, fileList) {
      // 当文件选择发生变化时触发
      console.log('当前选择的文件:', file)
      // 将原始文件对象保存到form中，注意这里要用file.raw获取原始文件
      this.forms.face = file
      // this.test =JSON.parse(JSON.stringify(file.raw))
      // this.form.face = file;
      this.test = file.raw
      // this.test.push(file.raw);
    },
    handleSearchFaceChangeSearch(file, fileList) {
      if (fileList.length >= 1) {
        this.isShowFace3 = true
      }
      this.formDataSearch.face = file
    },
    handleSearchFaceChange(file, fileList) {
      if (fileList.length >= 1) {
        this.isShowFace3 = true
      }
      console.log(file)
      this.formData1.face = file
    },
    handleChangeFaceImg2(file, fileList) {
      if (fileList.length >= 1) {
        this.isShowFace2 = true
      }
      this.imageUrl2 = URL.createObjectURL(file.raw)

      this.formData.files.push(file.raw)
      this.showResult = false
    },

    handleChange(file, fileList) {
      this.imageUrl1 = URL.createObjectURL(file.raw)
      console.log(this.imageUrl1)

      if (fileList.length >= 1) {
        this.isShowFace1 = true
      }
      this.formData.files.push(file.raw)
      this.showResult = false
    },

    selectApi(index) {
      this.currentApiIndex = index
      this.requestParams = []
      this.fileList = []
      this.responseData = ''
      this.imageUrl1 = ''
      this.imageUrl2 = ''
      this.formData = { files: [] }
      this.formData1 = { face: '' }
      this.formDataSearch = { face: '' }
      this.forms = { face: '' }
      this.test = ''
      // 初始化参数
      if (
        this.currentApi.body &&
        Object.keys(this.currentApi.body).length > 0
      ) {
        this.requestParams = Object.entries(this.currentApi.body).map(
          ([key, value]) => ({
            key,
            value:
              typeof value === 'object' ? JSON.stringify(value) : String(value),
          })
        )
      } else {
        this.addParam()
      }
    },
    addParam() {
      this.requestParams.push({
        key: '',
        value: '',
      })
    },
    removeParam(index) {
      this.requestParams.splice(index, 1)
    },
    handleFileChange(file, fileList) {
      this.fileList = fileList
    },
    async sendRequest(e) {
      if (!this.currentApi) return
      if (e == 0) {
        // const baseURL = 'http://1.95.199.171:18080' // 基础地址
        const baseURL = 'https://szl.ht-huaweicloud.com/prod-api' // 基础地址

    
        this.sending = true
        this.responseData = '请求发送中...'

        try {
          // 从localStorage获取token
          const token = 'Bearer ' + getToken() // 假设getToken()是从localStorage获取token的方法

          // 基础请求头配置
          const headers = {
            'Content-Type': 'application/json',
            Authorization: token,
          }

          const params = this.requestParams.reduce((acc, param) => {
            if (param.key) acc[param.key] = param.value
            return acc
          }, {})

          let response
          const requestURL = `${baseURL}${this.currentApi.location}`
          const method = this.currentApi.method.toLowerCase()

          switch (method) {
            case 'get':
              response = await axios.get(requestURL, {
                params,
                headers,
              })
              break

            case 'post':
              const formData = new FormData()
              Object.entries(params).forEach(([key, value]) => {
                formData.append(key, value)
              })
              this.fileList.forEach((file) => {
                formData.append('files', file.raw)
              })

              response = await axios.post(requestURL, formData, {
                headers: {
                  ...headers,
                  // 'Content-Type': 'multipart/form-data'
                },
              })
              break

            case 'delete':
              response = await axios.delete(`${requestURL}${params.id}`, {
                // data: params,
                headers,
              })
              break

            default:
              throw new Error(`不支持的请求方法: ${method}`)
          }

          this.responseData = JSON.stringify(response.data, null, 2)
        } catch (error) {
          let errorMessage = error.message
          if (error.response) {
            errorMessage += `\n状态码: ${error.response.status}`
            if (error.response.data) {
              errorMessage += `\n响应数据: ${JSON.stringify(
                error.response.data,
                null,
                2
              )}`
            }
            // 如果是401未授权错误，跳转到登录页
            if (error.response.status === 401) {
              this.$router.push('/login')
            }
          }
          this.responseData = `请求失败: ${errorMessage}`
        } finally {
          this.sending = false
        }
      } else if (e == 1) {
        console.log('人脸集新增')
        this.submitFormset()
      } else if (e == 2) {
        console.log('人脸检测')
        this.searchForm()
      } else if (e == 3) {
        console.log('人脸对比')
        this.submitForm()
      } else if (e == 4) {
        console.log('人脸搜索')
        this.searchFormSubimt()
      }
    },
    /** 提交按钮 */
    async submitFormset() {
      // 检查是否已选择文件
      if (!this.forms.face) {
        this.$message.error('请先选择要上传的人脸图片')
        return
      }
      try {
        const res = await addFaceSetFace({
          file: this.test,
          faceSetId: this.currentApi.body.faceSetId,
        })
        console.log('上传成功:', res)
        this.responseData = JSON.stringify(res, null, 2)
      } catch (error) {}
    },
    searchFormSubimt() {
      if (!this.formDataSearch.face) {
        this.$message.error('请上传人脸图片')
        return
      }
      this.sending = true
      const a = {
        file: this.formDataSearch.face.raw,
        faceSetName: this.currentApi.body.faceSetName,
      }

      searchFace(a).then((response) => {
        this.responseData = JSON.stringify(response, null, 2)
        this.sending = false
      })
    },
    submitForm() {
      if (this.formData.files.length < 2) {
        this.$message.error('请上传两张人脸图片进行对比')
        return
      }
      this.sending = true
      let form = new FormData()
      for (const item of this.formData.files) {
        form.append('files', item)
      }

      compare(form)
        .then((response) => {
          this.responseData = JSON.stringify(response, null, 2)
          this.sending = false
        })
        .catch((error) => {
          this.sending = false
        })
    },
    searchForm() {
      if (!this.formData1.face) {
        this.$message.error('请上传人脸图片')
        return
      }
      this.sending = true
      detectFace({ file: this.formData1.face.raw })
        .then((response) => {
          this.responseData = JSON.stringify(response, null, 2)
          this.sending = false
        })
        .catch(() => {
          this.sending = false
        })
    },
  },
}
</script>

<style scoped>
.api-test-container {
  display: flex;
  height: 100vh;
  background-color: #f5f7fa;
}

.left-panel {
  width: 300px;
  background-color: #fff;
  border-right: 1px solid #e6e6e6;
  display: flex;
  flex-direction: column;
}

.search-box {
  padding: 15px;
  border-bottom: 1px solid #e6e6e6;
}

.api-list {
  flex: 1;
  overflow-y: auto;
}

.api-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.3s;
}

.api-item:hover {
  background-color: #f5f7fa;
}

.api-item.active {
  background-color: #e6f7ff;
  border-left: 3px solid #1890ff;
}

.api-name {
  font-weight: 500;
  margin-bottom: 5px;
}

.api-method {
  display: inline-block;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  margin-right: 8px;
}

.api-method.get {
  background-color: #67c23a;
}

.api-method.post {
  background-color: #e6a23c;
}

.api-method.put {
  background-color: #409eff;
}

.api-method.delete {
  background-color: #f56c6c;
}

.api-location {
  font-size: 12px;
  color: #666;
  word-break: break-all;
}

.right-panel {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.api-header {
  margin-bottom: 20px;
}

.api-header h2 {
  margin: 0 0 10px 0;
  color: #333;
}

.api-meta {
  display: flex;
  align-items: center;
}

.method-tag {
  margin-right: 10px;
}

.api-url {
  flex: 1;
  font-family: monospace;
  background-color: #f5f5f5;
  padding: 5px 10px;
  border-radius: 3px;
  margin-right: 10px;
  word-break: break-all;
}

.request-section,
.response-section {
  background-color: #fff;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.request-section h3,
.response-section h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
}

.params-editor {
  margin-bottom: 20px;
}

.param-row {
  display: flex;
  margin-bottom: 10px;
  align-items: center;
}

.param-key {
  flex: 1;
  margin-right: 10px;
}

.param-value {
  flex: 2;
  margin-right: 10px;
}

.file-upload {
  margin-top: 20px;
}

.response-data {
  background-color: #f5f5f5;
  padding: 10px;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.upload-group {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}
</style>

<style lang="scss" scoped>
.face-recognition-container {
  padding: 20px;
  background-color: #f5f7fa;
  min-height: calc(100vh - 40px);

  .main-card {
    border-radius: 8px;
    border: none;

    ::v-deep .el-card__body {
      padding: 0;
    }
  }

  .custom-tabs {
    ::v-deep .el-tabs__header {
      margin: 0;
      background-color: #fff;
      border-radius: 8px 8px 0 0;
    }

    ::v-deep .el-tabs__item {
      height: 50px;
      line-height: 50px;
      font-size: 16px;
      padding: 0 25px;

      &.is-active {
        color: #409eff;
        font-weight: bold;
      }
    }
  }

  .search-pane {
    padding: 20px;

    .search-form {
      background-color: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

      .upload-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 200px;
      }

      ::v-deep .custom-input {
        .el-input-group__prepend {
          background-color: #f5f7fa;
          border-right: none;
        }

        .el-input__inner {
          border-left: none;
        }
      }

      .custom-input-number {
        width: 100%;

        ::v-deep .el-input-number__decrease,
        ::v-deep .el-input-number__increase {
          background: #f5f7fa;
        }
      }

      .search-btn-col {
        display: flex;
        justify-content: flex-end;
      }

      .search-btn {
        width: 150px;
        height: 40px;
        font-size: 16px;
      }
    }

    .result-section {
      margin-top: 20px;
      background-color: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

      .result-title {
        color: #606266;
        margin-bottom: 20px;
        font-size: 18px;
        display: flex;
        align-items: center;

        &:before {
          content: '';
          display: inline-block;
          width: 4px;
          height: 18px;
          background-color: #409eff;
          margin-right: 10px;
          border-radius: 2px;
        }
      }

      ::v-deep .result-table {
        th {
          background-color: #f8fafc;
          color: #606266;
          font-weight: bold;
        }
      }

      .coordinate-detail {
        // p {
        //   margin: 5px 0;
        //   color: #606266;
        // }
      }

      .coordinate-wrapper {
        cursor: pointer;
        color: #409eff;

        &:hover {
          text-decoration: underline;
        }
      }
    }
  }

  .compare-pane {
    padding: 20px;

    .compare-form {
      background-color: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

      .upload-group {
        display: flex;
        justify-content: space-around;
        margin-bottom: 20px;

        .upload-item {
          width: 45%;

          .upload-title {
            color: #606266;
            margin-bottom: 15px;
            text-align: center;
          }

          .compare-upload {
            display: flex;
            flex-direction: column;
            align-items: center;

            ::v-deep .el-upload--picture-card {
              width: 200px;
              height: 200px;
              line-height: 200px;
              margin-bottom: 10px;
            }

            ::v-deep .el-upload-list__item {
              width: 200px;
              height: 200px;
            }

            .el-upload__tip {
              color: #909399;
              font-size: 12px;
              text-align: center;
            }
          }
        }
      }

      .compare-btn-container {
        display: flex;
        justify-content: center;
        margin-top: 30px;

        .compare-btn {
          width: 150px;
          height: 40px;
          font-size: 16px;
          margin: 0 15px;
        }
      }
    }

    .compare-result {
      margin-top: 30px;
      background-color: #fff;
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

      ::v-deep .el-divider__text {
        background-color: #fff;
        color: #409eff;
        font-size: 16px;
      }

      .result-grid {
        margin-bottom: 20px;

        .result-card {
          border-radius: 8px;

          .result-card-header {
            font-weight: bold;
            color: #409eff;
            border-bottom: 1px solid #ebeef5;
            padding: 12px 20px;
          }

          .result-card-content {
            padding: 15px;

            .result-item {
              margin-bottom: 10px;

              .result-label {
                color: #909399;
                font-weight: bold;
              }

              .result-value {
                color: #606266;
              }
            }
          }
        }
      }

      .similarity-card {
        border-radius: 8px;
        border: none;
        background-color: #f8fafc;

        .similarity-content {
          display: flex;
          flex-direction: column;
          align-items: center;
          padding: 20px;

          .similarity-text {
            font-size: 16px;
            color: #909399;
            margin-bottom: 10px;
          }

          .similarity-value {
            font-size: 36px;
            font-weight: bold;
            color: #409eff;
            margin-bottom: 20px;
          }

          .similarity-progress {
            width: 80%;
            margin-bottom: 10px;
          }
        }
      }
    }
  }

  ::v-deep .hide .el-upload--picture-card {
    display: none;
  }
}
.img {
  width: 150px;
  height: 150px;
}
</style>